#import <Foundation/Foundation.h>
#import <CoreFoundation/CoreFoundation.h>
#import <UIKit/CDStructures.h>
#import <UIKit/UIApplication.h>
#import <UIKit/UIView.h>
#import <UIKit/UINavigationBar.h>
#import <UIKit/UITextView.h>
#import <UIKit/UISectionList.h>
#import <UIKit/UISectionTable.h>
#import <UIKit/UIPushButton.h>
#import <UIKit/UIThreePartButton.h>
#import <UIKit/UINavBarButton.h>
#import <UIKit/UIWindow.h>
#import <UIKit/UIView-Hierarchy.h>
#import <UIKit/UIHardware.h>
#import <UIKit/UIImage.h>
#import <UIKit/UIButtonBar.h>
#import <UIKit/UITextLabel.h>
#import <UIKit/UIImageView.h>
#import <UIKit/UIKeyboard.h>
#import <UIKit/UINavigationItem.h>
#import <UIKit/UIGradientBar.h>
#import <UIKit/UISegmentedControl.h>
#import <UIKit/UITable.h>
#import <UIKit/UITableColumn.h>
#import <UIKit/UITableCell.h>
#import <UIKit/UIImageAndTextTableCell.h>
#import <UIKit/UIDatePicker.h>
#import <UIKit/UIKit.h>

#import <WebCore/WebFontCache.h>

//dictionary key values
#define KEY_COUNTER_COUNT		@"count"
#define KEY_COUNTER_NAME		@"name"
#define KEY_COUNTER_VALUE		@"value"
#define KEY_COUNTER_DTYPE		@"type"
#define KEY_COUNTER_NEGATIVE	@"neg"
#define KEY_COUNTER_PROMPTED    @"prompted"

#define MAX_COUNTERS 4
#define MOON_SECONDS (27.321582f*60*60*24)
#define DAY_SECONDS (24*60*60)
#define HOUR_SECONDS (60*60)
#define MINUTE_SECONDS 60

@class SetupView;
@class CustomTable;
@class CustomTableCell;

@interface CDList : UIView
{	
	UIApplication* 				_application;
	NSString* 					_applicationID;
	CGRect 						_appTableRect;
	
	CustomTable*				_counterTable;
	UITableColumn* 				_counterTableCol;	
	NSMutableArray*				_counterCells;
	
	int							_selectedCellIndex;
	id 							_delegate;
	UINavigationBar*			_navbar;
	UINavBarButton*				_editButton;
	UINavBarButton*				_addButton;
	NSString*					_pathToCountersSaved;	
	NSMutableDictionary*		_counterListFromCounterDir;
	
	NSMutableArray*             _theCounters;
	NSMutableArray*				_theCounterIsNegative;
	NSMutableArray*				_theCounterName;
	NSMutableArray*				_theCounterDisplayType;
	
	NSTimer *					_timer;
	NSFileManager* 				_fileManager;
	NSTimer*					_timerM;
	
	struct __GSFont*			_counterFont;
	SetupView*					_setupView;
	NSMutableArray*             _theCounterPromptedExpired;
}
- (id) initWithApplication: (UIApplication*)app withAppID: (NSString*)appID withFrame: (struct CGRect)rect;
- (void) raiseAlert: (NSString*)msg;
- (void) refreshCounterList;
- (void) setDelegate: (id)delegate;
- (id) displaytick: (NSTimer *)timer;
- (void) saveCounters;
- (void) initCounterListFromCounterDir;
- (void) redisplayCountDowns;
- (int) getSelectedCounterDisplayType;
- (void) setSelectedCounterDisplayType: (NSNumber*)dtype;
- (void) setSelectedCounterName: (NSString *)theName;
- (NSString *)                         getSelectedCounterName;
- (void)setEditedCounter: (NSDate *)theEditedCounter;
- (void) editCountDown;
- (void) addNewCountDown;
- (void) displayTable;
- (void) removeRow: (int)row;
- (void) setSetupAccess: (SetupView *) theView;
- (void)alertSheet:(UIAlertSheet*)sheet buttonClicked:(int)button;
@end

//Protocol for browser state change notifications
@interface NSObject (CDListStateChange)
- (void) browserCurrentSelectedPathChanged: (CDList*)browser toPath: (NSString*)path;
@end

